function cookie(name, value, options = {}) {
  // setCookie 
  if (typeof name === "string" && typeof value === "string") {
    // 因为日期对象比较特殊所以我们需要先创建日期对象; 
    // 传入的数据要求是number 类型, 代表的涵义是cookie在几天之后过期; 
    if (typeof options.expires === "number") {
      var d = new Date();
      d.setDate(d.getDate() + options.expires);
      options.expires = d;
    }
    // 把所有的参数拼接成符合cookie规则的字符串;
    return document.cookie = [
      name, "=", value,
      typeof options.path === "string" ? ";path=" + options.path : "",
      typeof options.domain === "string" ? ";domain=" + options.domain : "",
      typeof options.expires === "object" ? ";expires=" + options.expires : ""
    ].join("");
  }
  // removeCookie 
  if (typeof name === "string" && value === null) {
    return cookie(name, "delete", Object.assign({
      expires: - 1
    }, options))
  }
  // getCookie 
  if (typeof name === "string") {
    // 拆分的依据一定是 : 分号*空格*; 一定要记住是有空格的;
    var cookie_array = document.cookie.split("; ");
    // 遍历cookie数组查询正确的cookie数据; 
    for (var i = 0; i < cookie_array.length; i++) {
      var item = cookie_array[i].split("=")
      if (item[0] === name) {
        return item[1];
      }
    }
    return "";
  }
}